Enter password: *********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.32 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| rezodb     |
+------------+
1 row in set (0.00 sec)

mysql> CREATE TABLE emp_table (emp_no INT, emp_name VARCHAR(50), salary INT);
Query OK, 0 rows affected (0.03 sec)

mysql> INSERT INTO emp_table VALUES (1, '井上', 20000);
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO emp_table VALUES (2, '梅田', 100000);
Query OK, 1 row affected (0.01 sec)

mysql> SELECT *FROM emp_table;
+--------+----------+--------+
| emp_no | emp_name | salary |
+--------+----------+--------+
|      1 | 井上     |  20000 |
|      2 | 梅田     | 100000 |
+--------+----------+--------+
2 rows in set (0.00 sec)

mysql> CREATE TABLE book_table (book_id INT, book_name VARCHAR(50), author_name VARCHAR(50), price INT, sales_flag INT);
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT INTO book_table VALUES (10001, 'TwoPeace', '三田英一郎',　420, 1);
ERROR 1054 (42S22): Unknown column '　420' in 'field list'
mysql>  INSERT INTO book_table VALUES (10001, 'TwoPeace', '三田英一郎', 420, 1);
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO book_table VALUES (10002, '名探偵金田二', '青山ふみや',　460, 1);
ERROR 1054 (42S22): Unknown column '　460' in 'field list'
mysql> INSERT INTO book_table VALUES (10002, '名探偵金田二', '青山ふみや', 460, 1);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO book_table VALUES (10003, '坊ちゃま', '冬目漱石', 460, 1);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO book_table VALUES (10004, '西方見聞録', '不明', 1000, 1);
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO book_table VALUES (10005, '吾輩は犬である', '冬目漱石', 420, 1);
Query OK, 1 row affected (0.01 sec)

mysql> SELECT * FROM book_table;
+---------+----------------+-------------+-------+------------+
| book_id | book_name      | author_name | price | sales_flag |
+---------+----------------+-------------+-------+------------+
|   10001 | TwoPeace       | 三田英一郎  |   420 |          1 |
|   10002 | 名探偵金田二   | 青山ふみや  |   460 |          1 |
|   10003 | 坊ちゃま       | 冬目漱石    |   460 |          1 |
|   10004 | 西方見聞録     | 不明        |  1000 |          1 |
|   10005 | 吾輩は犬である | 冬目漱石    |   420 |          1 |
+---------+----------------+-------------+-------+------------+
5 rows in set (0.00 sec)

mysql> SELECT book_name FROM book_table;
+----------------+
| book_name      |
+----------------+
| TwoPeace       |
| 名探偵金田二   |
| 坊ちゃま       |
| 西方見聞録     |
| 吾輩は犬である |
+----------------+
5 rows in set (0.00 sec)

mysql> SELECT book_name author_name FROM book_table;
+----------------+
| author_name    |
+----------------+
| TwoPeace       |
| 名探偵金田二   |
| 坊ちゃま       |
| 西方見聞録     |
| 吾輩は犬である |
+----------------+
5 rows in set (0.00 sec)

mysql> SELECT book_name, author_name FROM book_table;
+----------------+-------------+
| book_name      | author_name |
+----------------+-------------+
| TwoPeace       | 三田英一郎  |
| 名探偵金田二   | 青山ふみや  |
| 坊ちゃま       | 冬目漱石    |
| 西方見聞録     | 不明        |
| 吾輩は犬である | 冬目漱石    |
+----------------+-------------+
5 rows in set (0.00 sec)

mysql> UPDATE book_table SET author_name = 'マール＝コー＝ポロ'　SET sales_flag = 0 where book_id = 10004;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '　SET sales_flag = 0 where book_id = 10004' at line 1
mysql> UPDATE book_table SET author_name = 'マール＝コー＝ポロ'  where book_id = 10004;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> UPDATE book_table ]SET sales_flag = 0 where book_id = 10004;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ']SET sales_flag = 0 where book_id = 10004' at line 1
mysql> UPDATE book_table SET sales_flag = 0 where book_id = 10004;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM book_table;
+---------+----------------+--------------------+-------+------------+
| book_id | book_name      | author_name        | price | sales_flag |
+---------+----------------+--------------------+-------+------------+
|   10001 | TwoPeace       | 三田英一郎         |   420 |          1 |
|   10002 | 名探偵金田二   | 青山ふみや         |   460 |          1 |
|   10003 | 坊ちゃま       | 冬目漱石           |   460 |          1 |
|   10004 | 西方見聞録     | マール＝コー＝ポロ |  1000 |          0 |
|   10005 | 吾輩は犬である | 冬目漱石           |   420 |          1 |
+---------+----------------+--------------------+-------+------------+
5 rows in set (0.00 sec)

mysql> SELECT * FROM book_table where sales_flag = 1;
+---------+----------------+-------------+-------+------------+
| book_id | book_name      | author_name | price | sales_flag |
+---------+----------------+-------------+-------+------------+
|   10001 | TwoPeace       | 三田英一郎  |   420 |          1 |
|   10002 | 名探偵金田二   | 青山ふみや  |   460 |          1 |
|   10003 | 坊ちゃま       | 冬目漱石    |   460 |          1 |
|   10005 | 吾輩は犬である | 冬目漱石    |   420 |          1 |
+---------+----------------+-------------+-------+------------+
4 rows in set (0.00 sec)

mysql> SELECT * FROM book_table where author_name = '冬目漱石'　AND price = 420;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '　AND price = 420' at line 1
mysql> SELECT * FROM book_table where author_name = '冬目漱石' AND price = 420;
+---------+----------------+-------------+-------+------------+
| book_id | book_name      | author_name | price | sales_flag |
+---------+----------------+-------------+-------+------------+
|   10005 | 吾輩は犬である | 冬目漱石    |   420 |          1 |
+---------+----------------+-------------+-------+------------+
1 row in set (0.00 sec)

mysql> DELETE FROM book_table WHERE book_id = 10003;
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM book_table;
+---------+----------------+--------------------+-------+------------+
| book_id | book_name      | author_name        | price | sales_flag |
+---------+----------------+--------------------+-------+------------+
|   10001 | TwoPeace       | 三田英一郎         |   420 |          1 |
|   10002 | 名探偵金田二   | 青山ふみや         |   460 |          1 |
|   10004 | 西方見聞録     | マール＝コー＝ポロ |  1000 |          0 |
|   10005 | 吾輩は犬である | 冬目漱石           |   420 |          1 |
+---------+----------------+--------------------+-------+------------+
4 rows in set (0.00 sec)

mysql>
